package com.sniper.amqp.sender;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * @author suzhen
 * @create 2018/3/19
 */
@Component
public class Sender {

    @Resource
    private AmqpTemplate amqpTemplate;

    public void send() {
        String context = "hello " + LocalDateTime.now();
        System.out.println(context);
        this.amqpTemplate.convertAndSend("hello", context);
    }
}
